Skip to content

fix(server): preserve one-shot cooldown bypasses - #108

Merged
chrisohearn merged 3 commits into
integration/mcp-events-20261109from
r4/failover-bypass-followup
Nov 13, 2026
Merged

chrisohearn merged 3 commits into
integration/mcp-events-20261109from
r4/failover-bypass-followup

Conversation

@chrisohearn

@chrisohearn chrisohearn commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #88's delta review, specifically its fastMode P2 and all three P3 findings: automatic runs consuming pending picks, repeated scheduled bypass while queued runs remain held, and missing dispatch-side scheduled-pick and multi-continuation tests.

Ordinary web sends could bypass an account cooldown because fastMode: false differed from an omitted option. Automatic runs could consume a pending explicit pick, while a lingering scheduled pick could bypass repeatedly.

Changes

  • Compare sent selections with draftModelPickMatchesThread, so Fast off and unset mean the same thing in either direction.
  • Reuse the existing persisted thread bypass flag for scheduled picks. Only a resendable prompt using the selected model consumes it, once. A held queued run no longer lets a schedule repeatedly bypass cooldown routing.
  • Share the existing resendability policy between failover and bypass consumption. Notification wakes and delegated completions preserve the pending pick on both dispatch and queued start, including when another thread-metadata event is written.
  • Keep the existing failover, restart, claimed-run, and provider-specific message guards. No new schema, migration, dependency, live settings change, restart, merge, or deployment.

Verification

Head bb1c50cd59ef4b2ffc58ae2e117f9cd41fd347ea, including fresh integration 56e297dccc5bc07cce51e273c35c933e50ecfb4c. The integration merge changed only host-guard files, not the checked runtime source. Pushed without force.

All 23 focused tests pass: 15 provider-switch/routing/failover cases, 3 runtime cases covering scheduled picks, multiple old-model server continuations, two notification wakes and delegated completions, and 5 failover/cooldown unit cases. Scoped formatting, lint and diff checks pass on the four changed files. Every heavy command used the shared lock, and Vitest used two workers with no file parallelism.

Five regression cases failed before the fix at the intended assertions: Fast off versus omitted in both directions, a repeated direct scheduled send with a held queue, a notification consuming the pick, and a queued delegated completion consuming it. Existing test cases and tables were extended; no new test file was added.

Hosted CI is the typecheck gate. Local dependencies remain stale after the upstream merge, as already diagnosed and accepted by the coordinator; no reinstall or unrelated type repair was attempted.

Acceptance commands

These isolated tests use replay adapters and temporary state, not the live database or paid provider turns. Run from the repository root:

export PATH="$PWD/node_modules/.bin:$PATH"
flock -w 1800 ~/.cache/t3-r4/heavy.lock vp test run apps/server/src/orchestration-v2/testkit/ProviderSwitch.integration.test.ts -t 're-sends a message on the fallback|keeps queued .* routing safe' --maxWorkers=2 --no-file-parallelism
flock -w 1800 ~/.cache/t3-r4/heavy.lock vp test run apps/server/src/orchestration-v2/runtimeLayer.test.ts -t 'keeps a scheduled model change|starts every message queued behind a scheduled model change|starts a queued delegated completion on a selection set' --maxWorkers=2 --no-file-parallelism
flock -w 1800 ~/.cache/t3-r4/heavy.lock vp test run apps/server/src/orchestration-v2/ProviderFailover.test.ts apps/server/src/provider/ProviderCooldown.test.ts --maxWorkers=2 --no-file-parallelism

Implemented with GPT-6.1 Sol in Codex CLI.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants